// --------------------------------------------------------------------------------------------------------------------
// <copyright file="KukaLBR4ControllerTests.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Test.Robotics.Hardware.KukaLBR.KukaLBR4Tests
{
    using System;
    using System.Runtime.InteropServices;

    using Microsoft.Robotics.Hardware.KukaLBR;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using LBR4 = Microsoft.Robotics.Hardware.KukaLBR.KukaLBR4PlusCsharpDefinitionsNativeMethods;

    /// <summary>
    /// Test the functionality KukaLBR4Controller and related classes
    /// </summary>
    [TestClass]
    public class KukaLBR4ControllerTest
    {
        /// <summary>
        /// Test the basic functionality of the <c>KukaLBR4RegisterManager()</c>.
        /// </summary>
        [TestMethod]
        [TestCategory("Unit")]
        [Priority(0)]
        public void KukaLBR4RegisterManagerTest()
        {
            KukaLBR4WorkingRegisterManager registerManager = new KukaLBR4WorkingRegisterManager();

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Scalar1Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Scalar),
                "Expect Scalar1Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Scalar2Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Scalar),
                "Expect Scalar2Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Scalar3Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Scalar),
                "Expect Scalar3Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Scalar4Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Scalar),
                "Expect Scalar4Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Scalar5Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Scalar),
                "Expect Scalar5Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Scalar6Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Scalar),
                "Expect Scalar6Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Scalar7Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Scalar),
                "Expect Scalar7Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Scalar8Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Scalar),
                "Expect Scalar8Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.CartVec1Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.CartesianVector),
                "Exepect CartVec1Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.CartVec2Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.CartesianVector),
                "Exepect CartVec2Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.CartVec3Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.CartesianVector),
                "Exepect CartVec3Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.JointVec1Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.JointVector),
                "Expect JointVec1Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.JointVec2Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.JointVector),
                "Expect JointVec2Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.JointVec3Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.JointVector),
                "Expect JointVec3Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Frame1Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Frame),
                "Expect Frame1Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Frame2Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Frame),
                "Expect Frame2Register");

            Assert.AreEqual(
                (int)LBR4.KukaLBR4PlusWorkingRegisters.Frame3Register,
                registerManager.GetNextRegisterID(KukaLBR4WorkingRegisterManager.RegisterValueTypes.Frame),
                "Expect Frame3Register");
        }
    }
}
